package com.shen.accountbook.module.home.reportformsfragment;

import android.content.Context;

import com.shen.accountbook.R;
import com.shen.accountbook.bean.ReportFormsBean;
import com.shen.accountbook.bean.temp.NoteBeanTemp;
import com.shen.accountbook.bean.temp.biz.NoteBeanTempBiz;
import com.shen.accountbook.module.base.BasePresenter;
import com.shen.accountbook.utils.L;

import java.util.List;

import io.reactivex.Observer;
import io.reactivex.disposables.Disposable;

/**
 * author:  shen
 */
public class ReportFormsPresenterImpl extends BasePresenter<ReportFormsView, ReportFormsModelImpl> {

    public ReportFormsPresenterImpl(Context context, ReportFormsView mvpView) {
        super(context, mvpView);
    }

    @Override
    protected ReportFormsModelImpl createModel() {
        return new ReportFormsModelImpl();
    }


    /**
     * 数据库中获取"三级分类" -- 根据第一分类获取第三分类
     * @return
     */
    public void getBeanByDateReport(String date) {
        NoteBeanTempBiz biz = new NoteBeanTempBiz();
        biz.getBeanByDateReport(date, new Observer<ReportFormsBean>() {
            @Override
            public void onSubscribe(Disposable d) {

            }

            @Override
            public void onNext(ReportFormsBean reportFormsBean) {
                mvpView.setData(reportFormsBean);
            }

            @Override
            public void onError(Throwable e) {
                L.i("getBeanByDate -- error :" , e);
            }

            @Override
            public void onComplete() {

            }
        });
    }
}
